<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});
Route::get('/',function (){
    return '小样，请不要偷看了1';
});


Route::group(['prefix' => 'v1'], function() {
    Route::get('/',function (){
        return '小样，请不要偷看了';
    });

    //不需要登录
    Route::post('login',   'AuthController@login');//登录
    Route::post('refresh', 'AuthController@refresh');//刷新token

    Route::any('push',   'PushController@index');//消息推送

    //需要登录
    Route::group(['middleware' => 'auth:api'], function(){
        //用户
        Route::group(['prefix' => 'user'], function(){
            Route::get ('/','UserController@user');//用户信息
            Route::get ('follows','UserController@follows');//用户关注列表
            Route::get ('follow/list','UserController@userFollows');//用户关注列表
            Route::get ('history','UserController@history');//用户播放记录
            Route::post('update','UserController@update');//用户播放记录
        });
        //关注
        Route::group(['prefix' => 'follow'], function(){
            Route::post('/','FollowController@index');//关注/取消关注分类
        });

        //评论
        Route::group(['prefix' => 'comment'], function(){
            Route::get ('/','CommentController@index');//评论列表
            Route::post('replay','CommentController@replay');//评论视频
        });


        //点赞（评论）
        Route::group(['prefix' => 'praise'], function(){
            Route::get ('/','PraiseController@index');//点赞列表（评论）
            Route::post('store','PraiseController@store');//点赞评论（评论）
        });

        //视频列表
        Route::group(['prefix' => 'video'], function(){
            Route::get ('/',   'VideoController@index');//视频列表
            Route::get ('info','VideoController@info');//视频详情
            Route::get ('list','VideoController@list');//视频详情列表
            Route::post('share','VideoController@share');//统计分享次数
            Route::get ('rand/list','VideoController@randList');//视频详情列表
            Route::post ('zan','VideoController@zan');//点赞（视频）
            Route::post ('collect','VideoController@collect');//收藏（视频）
            Route::get ('collect/list','VideoController@collectList');//获取个人收藏列表（视频）
            Route::get ('wheel/list','VideoController@wheelList');//获取首页视频轮播列表（视频）
        });

        //分类
        Route::group(['prefix' => 'cate'], function(){
            Route::get ('/','CateController@index');//分类列表
            Route::get ('info','CateController@info');//分类详情
            Route::get ('video','CateController@video');//分类视频列表
        });

        //收集formid
        Route::post('form','FormController@index');//分类列表
    });


});